package com.buddy.learn.algorithm.demo;

import java.util.Scanner;

/**
 * @author Buddy
 * @date 2021/5/6
 */
public class _007取近似值 {

    /**
     * 写出一个程序，接受一个正浮点数值，输出该数值的近似整数值。如果小数点后数值大于等于5,向上取整；小于5，则向下取整。
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        //输入参数
        double a = in.nextDouble();
        //取整数部分
        int b = (int) a;
        System.out.println(a + "," + b);
        //判断
        if ((a - b) >= 0.5) {
            b = (int) (a + 0.5);
        }
        System.out.println(b);
    }
}
